package com.twu.biblioteca;

import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by adhulip on 3/10/14.
 */
public class Menu {
    private BibliotecaInputManager inputManager;
    private OptionManager optionManager;
    private Library library;
    private Printer printer;
    private List<String> listOfMenuOptions = new ArrayList<String>(Arrays.asList("1. List Books"));

    public Menu(Printer printer, Library library, BibliotecaInputManager inputManager, OptionManager optionManager) {
        this.printer = printer;
        this.library = library;
        this.inputManager = inputManager;
        this.optionManager = optionManager;
    }

    public void render() {
        printer.render(listOfMenuOptions);
    }

    public void chooseOption(String option) {
        if(option.equals("1")) {
            printer.render(library);
        }
    }

    public boolean choiceIsExit(String option) {
        boolean shouldExit = false;
        if (option.equals("2")) {
            shouldExit = true;
        }
        return shouldExit;
    }

    public void start() {
        String userInput = inputManager.read();
        optionManager.validate(userInput);
    }

}
